package com.luo.pojo.blog;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author Pro Luo
 * @since 2020-08-05
 *    示例实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
//@ApiModel(value="Blog对象", description="")
public class Blog implements Serializable {

    private static final long serialVersionUID = 1L;

//    @ApiModelProperty(value = "博客id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

//    @ApiModelProperty(value = "博客标题")
    private String title;

//    @ApiModelProperty(value = "博客封面")
    private String cover;

//    @ApiModelProperty(value = "博客简介")
    private String instruction;

//    @ApiModelProperty(value = "作者")
    private String author;

//    @ApiModelProperty(value = "内容")
    private String content;

//    @ApiModelProperty(value = "博客状态")
    private String status;

//    @ApiModelProperty(value = "点赞数")
    @TableField(update = "%s+1")
    private Integer likeNum;

//    @ApiModelProperty(value = "阅读数")
    @TableField(update = "%s+1")
    private Integer readNum;

//    @ApiModelProperty(value = "收藏数")
    @TableField(update = "%s+1")
    private Integer collectNum;

//    @ApiModelProperty(value = "评论数")
    @TableField(update = "%s+1")
    private Integer commentNum;

//    @ApiModelProperty(value = "是否为推荐博客,0:否，1:是")
    private Integer ifRecommended;

//    @ApiModelProperty(value = "是否开启评论,0:否，1:是")
    private Integer ifComment;

//    @ApiModelProperty(value = "是否公开,0:否，1:是")
    private Integer ifPrivate;

//    @ApiModelProperty(value = "博客对应分类的id")
    @TableField("blog_classifyId")
    private Integer blogClassifyid;

//    @ApiModelProperty(value = "博客所属用户id")
    private Integer userId;

//    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

//    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Override
    public String toString() {
        return
            "博客标题:   " + title + '\n'+
            "博客作者:   " + author + '\n' +
            "博客简介:   " + instruction + '\n' +
            "博客作更新时间:   " + createTime + '\n' +
            "博客阅读人数:   " + readNum + '\n' +
            "博客收藏人数:   " + collectNum + '\n' +
            "博客点赞人数:   " + likeNum + '\n' +
            "博客评论人数:   " + commentNum + '\n' +
            "作者ID:    " + userId + '\n' +
            "博客内容(html格式):   " + "\n" + content + '\n'+'\n';
    }

}
